Skip to content

docs(start): add Docker with Bun and improved Cloudflare setup for hosting guide #4898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bapspatil
Copy link

@bapspatil bapspatil commented Aug 9, 2025

Summary

  • Improved Cloudflare Workers configuration using wrangler.jsonc
  • Added Docker containerization guidance using Bun

What changed

  • Deleted Cloudflare Pages references
  • Left Cloudflare Workers section intact, including wrangler.jsonc example and Deploy to Cloudflare button notes
  • Left Docker with Bun section intact, including multi-stage Dockerfile, .dockerignore, optional docker-compose.yaml, and Coolify notes

Why

  • Consolidate Cloudflare guidance around Workers only
  • Align with project preferences for Bun and wrangler.jsonc (wrangler.toml is outdated)
  • Provide developers with the option to self-host their TanStack Start app on their own server with Docker

How to test

  • Docker with Bun
    1. Set target: 'bun' in vite.config.ts
    2. Build image: docker build -t my-tanstack-start-app .
    3. Run: docker run --rm -p 8080:5173 -e HOST=0.0.0.0 -e PORT=5173 my-tanstack-start-app
    4. Visit http://localhost:8080

Notes

  • Bun deployment guidance requires React 19 or newer
  • Prefer wrangler.jsonc over TOML
  • Server listens on PORT default 5173

Breaking changes

  • None

Summary by CodeRabbit

  • Documentation
    • Expanded React hosting guide with detailed Cloudflare Workers (module) deployment steps and updated configuration guidance (wrangler.jsonc preferred; TOML alternative with new compatibility date).
    • Added “Deploy to Cloudflare” button snippet with notes on Workers-only support and config detection.
    • Introduced Docker deployment workflow (multi-stage Dockerfile, Dockerignore, healthcheck, non-root user, exposed port, entrypoint).
    • Included Docker Compose example and Coolify deployment options with environment and networking tips.
    • Clarified server port/host bindings, build outputs, and recommendation to pin Bun version.

@github-actions github-actions bot added the documentation Everything documentation related label Aug 9, 2025
@bapspatil bapspatil marked this pull request as draft August 18, 2025 06:45
@bapspatil bapspatil marked this pull request as ready for review August 18, 2025 06:46
Copy link

coderabbitai bot commented Aug 18, 2025

Walkthrough

Documentation for React hosting was expanded and revised: Cloudflare deployment now references Workers via wrangler.jsonc with updated compatibility dates, a “Deploy to Cloudflare” button was added, and comprehensive Docker-based deployment guidance (Dockerfile, Compose, Coolify notes) was introduced, including ports, entrypoint, and build output specifics.

Changes

Cohort / File(s) Summary of Changes
React Hosting Docs Update
docs/start/framework/react/hosting.md
Replaced Cloudflare Pages with Cloudflare Workers (cloudflare-module); added wrangler.jsonc as primary config with updated compatibility_date; added “Deploy to Cloudflare” button and notes; introduced full Docker workflow (multi-stage Dockerfile, .dockerignore guidance, healthcheck, non-root, ports, entrypoint); added Docker Compose and Coolify deployment instructions; clarified server port (5173), host binding, build outputs, and Bun version pinning.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws, deploy with glee,
Clouds and containers, swift as can be.
Buttons to click, ports to align,
Bun in the oven—everything’s fine.
From Workers’ edge to Docker’s sea,
I ship my hops continuously. 🐇🚀

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
docs/start/framework/react/hosting.md (5)

168-175: Use stable React 19 tags instead of RC

Suggest installing the stable React 19 instead of the RC channel to avoid pulling pre-release builds.

Apply this diff to update the command:

-```sh
-npm install react@rc react-dom@rc
-```
+```sh
+npm install react@^19 react-dom@^19
+```

If you want to include Bun users, we can add an additional example with: bun add react@^19 react-dom@^19.


232-234: Remove build flag that may not be forwarded

Depending on your package.json scripts, passing --config vite.config.ts to bun run build may not be forwarded to Vite/TanStack Start. The build already picks up vite.config.ts by default.

Apply this diff:

-ENV NODE_ENV=production
-RUN bun run build --config vite.config.ts
+ENV NODE_ENV=production
+RUN bun run build

239-242: Optional: avoid installing curl in the runtime image

Installing curl increases image size and surface area. If you don’t need container-native health checks, omit curl and the HEALTHCHECK. Alternatively, use a smaller HTTP probe (for example, BusyBox’s wget) or rely on platform-level checks.

We can provide a slimmer variant if you prefer.


261-263: Prefer CMD and run the entry directly (not via “bun run”)

Using CMD makes overriding easier at runtime, and invoking the file directly avoids npm-script indirection.

Apply this diff:

-# Start the Bun server (SSR entry emitted by TanStack Start)
-ENTRYPOINT ["bun", "run", ".output/server/index.mjs"]
+# Start the Bun server (SSR entry emitted by TanStack Start)
+CMD ["bun", ".output/server/index.mjs"]

If you need ENTRYPOINT, consider:

  • ENTRYPOINT ["bun"]
  • CMD [".output/server/index.mjs"]

96-104: Nit: consider phrasing around compatibility_date

Cloudflare recommends pinning compatibility_date to a specific day for predictability. You might add a short note to encourage teams to set this to their project’s creation date and bump intentionally.

Happy to draft the sentence if you want to include it.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ef74fc6 and aab61d8.

📒 Files selected for processing (1)
  • docs/start/framework/react/hosting.md (4 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/start/framework/react/hosting.md

[grammar] ~38-~38: There might be a mistake here.
Context: ...e-workers): Deploy to Cloudflare Workers - node-server: Deploy to a Node.js server - [bun](#...

(QB_NEW_EN)


[grammar] ~39-~39: There might be a mistake here.
Context: ...r](#nodejs): Deploy to a Node.js server - [bun](#bun): Deploy to a Bun server - [docker`](#d...

(QB_NEW_EN)


[grammar] ~40-~40: There might be a mistake here.
Context: ... - bun: Deploy to a Bun server - docker: Deploy using Docker - ... and more to ...

(QB_NEW_EN)


[grammar] ~41-~41: There might be a mistake here.
Context: ...docker: Deploy using Docker - ... and more to come! Once you've chose...

(QB_NEW_EN)


[grammar] ~137-~137: There might be a mistake here.
Context: ...ensible defaults so deployments succeed. - For more, see the official docs: [Deploy...

(QB_NEW_EN)


[grammar] ~289-~289: There might be a mistake here.
Context: ...e at http://localhost:8080. > [!NOTE] > If you're also running a database or o...

(QB_NEW_EN)


[grammar] ~294-~294: There might be a mistake here.
Context: ...Optional: docker-compose.yaml > [!NOTE] > Use docker-compose.yaml when your Ta...

(QB_NEW_EN)


[grammar] ~334-~334: There might be a mistake here.
Context: ...ose (recommended for multi‑service apps) - Create a new service → Docker Compose → ...

(QB_NEW_EN)


[grammar] ~335-~335: There might be a mistake here.
Context: ...rvice → Docker Compose → Build from Git. - Connect your repo and branch; ensure the...

(QB_NEW_EN)


[grammar] ~337-~337: There might be a mistake here.
Context: ...n a subfolder (for example /apps/web). - Keep databases (for example Postgres on ...

(QB_NEW_EN)


[grammar] ~338-~338: There might be a mistake here.
Context: ...a service names (for example db:5432). - Set environment variables on the app s...

(QB_NEW_EN)


[grammar] ~344-~344: There might be a mistake here.
Context: ...le (recommended for single‑service apps) - Create a new service → Docker → Build fr...

(QB_NEW_EN)


[grammar] ~345-~345: There might be a mistake here.
Context: ... use a pre‑built image from a registry). - Connect your repo and branch; verify `Do...

(QB_NEW_EN)


[grammar] ~346-~346: There might be a mistake here.
Context: ...ckerfilepath (usually./Dockerfile`). - In Build Pack, select Dockerfile (Coolif...

(QB_NEW_EN)


[grammar] ~347-~347: There might be a mistake here.
Context: ...Directory if your app is in a subfolder. - Set environment variables: `NODE_ENV=pro...

(QB_NEW_EN)


[grammar] ~353-~353: There might be a mistake here.
Context: ...ost port (for example 8080) to 5173. - Set HOST=0.0.0.0 so the server binds t...

(QB_NEW_EN)


[grammar] ~356-~356: There might be a mistake here.
Context: ...balances stability and security updates. - Using a database? If Postgres is part of...

(QB_NEW_EN)


[grammar] ~357-~357: There might be a mistake here.
Context: ...for example Redis 6379, MySQL 3306). - If your database lives in a different Co...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)
docs/start/framework/react/hosting.md

357-357: Inconsistent indentation for list items at the same level
Expected: 0; Actual: 1

(MD005, list-indent)


357-357: Unordered list indentation
Expected: 0; Actual: 1

(MD007, ul-indent)


358-358: Inconsistent indentation for list items at the same level
Expected: 0; Actual: 2

(MD005, list-indent)


358-358: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)

🔇 Additional comments (6)
docs/start/framework/react/hosting.md (6)

38-41: Good call replacing Pages with Cloudflare Workers and adding Docker target

Anchor links match the section IDs and the targets look consistent with the guidance below.


96-111: Wrangler JSONC example looks correct

Fields and paths align with a module Worker setup and TanStack Start output locations.


114-124: TOML alternative is valid

The TOML variant mirrors JSONC correctly, including assets binding and nodejs_compat.


128-139: Deploy button guidance is accurate

Clear caveat about Workers-only support, and the link format is correct.


251-256: Ports and binding are clear

Explicitly exposing 5173 and setting HOST/PORT matches the rest of the doc and run instructions.


281-285: Run instructions match Dockerfile configuration

Port mapping and envs are consistent with the Dockerfile and the app’s default PORT.

Comment on lines +356 to +358
- Use the `oven/bun` image tag that matches your Bun version. Pinning a minor series (for example `1.2.19`) balances stability and security updates.
- Using a database? If Postgres is part of your deployment, ensure the app can reach port `5432` (prefer internal networking). Avoid exposing databases publicly; for local access map `5432:5432`. Apply the same guidance for other services (for example Redis `6379`, MySQL `3306`).
- If your database lives in a different Coolify stack, enable “Connect to Predefined Network” and reference the database service by its full stack-aware name. Otherwise, keep all services in the same compose stack to use the default internal network.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix Markdown list indentation (lint errors MD005/MD007)

Inconsistent indentation on these bullets triggers markdownlint. Align them to the top-level list.

Apply this diff:

-- - Using a database? If Postgres is part of your deployment, ensure the app can reach port `5432` (prefer internal networking). Avoid exposing databases publicly; for local access map `5432:5432`. Apply the same guidance for other services (for example Redis `6379`, MySQL `3306`).
--  - If your database lives in a different Coolify stack, enable “Connect to Predefined Network” and reference the database service by its full stack-aware name. Otherwise, keep all services in the same compose stack to use the default internal network.
+- Using a database? If Postgres is part of your deployment, ensure the app can reach port `5432` (prefer internal networking). Avoid exposing databases publicly; for local access map `5432:5432`. Apply the same guidance for other services (for example Redis `6379`, MySQL `3306`).
+- If your database lives in a different Coolify stack, enable “Connect to Predefined Network” and reference the database service by its full stack-aware name. Otherwise, keep all services in the same compose stack to use the default internal network.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Use the `oven/bun` image tag that matches your Bun version. Pinning a minor series (for example `1.2.19`) balances stability and security updates.
- Using a database? If Postgres is part of your deployment, ensure the app can reach port `5432` (prefer internal networking). Avoid exposing databases publicly; for local access map `5432:5432`. Apply the same guidance for other services (for example Redis `6379`, MySQL `3306`).
- If your database lives in a different Coolify stack, enable “Connect to Predefined Network” and reference the database service by its full stack-aware name. Otherwise, keep all services in the same compose stack to use the default internal network.
- Use the `oven/bun` image tag that matches your Bun version. Pinning a minor series (for example `1.2.19`) balances stability and security updates.
- Using a database? If Postgres is part of your deployment, ensure the app can reach port `5432` (prefer internal networking). Avoid exposing databases publicly; for local access map `5432:5432`. Apply the same guidance for other services (for example Redis `6379`, MySQL `3306`).
- If your database lives in a different Coolify stack, enable “Connect to Predefined Network” and reference the database service by its full stack-aware name. Otherwise, keep all services in the same compose stack to use the default internal network.
🧰 Tools
🪛 LanguageTool

[grammar] ~356-~356: There might be a mistake here.
Context: ...balances stability and security updates. - Using a database? If Postgres is part of...

(QB_NEW_EN)


[grammar] ~357-~357: There might be a mistake here.
Context: ...for example Redis 6379, MySQL 3306). - If your database lives in a different Co...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)

357-357: Inconsistent indentation for list items at the same level
Expected: 0; Actual: 1

(MD005, list-indent)


357-357: Unordered list indentation
Expected: 0; Actual: 1

(MD007, ul-indent)


358-358: Inconsistent indentation for list items at the same level
Expected: 0; Actual: 2

(MD005, list-indent)


358-358: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)

🤖 Prompt for AI Agents
In docs/start/framework/react/hosting.md around lines 356-358, the bulleted list
has inconsistent indentation causing markdownlint MD005/MD007; fix by aligning
all list items to the same top-level indentation (remove the extra space before
the second and third bullets so they start at the same column as the first),
ensuring consistent use of a single space after each dash and preserving inline
code and examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Everything documentation related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant